<?php 
	require_once("gzipJS.php");
?>
/****************************
* Global variables
*****************************/
function show_contact_form(){
	var modal = $('#myModal');
	
	$('#contact_form').show();
	$('#send_email_success').hide();
	$('#invalid_email').hide();
	
	modal.height('10px');
	modal.css('top','50%');
	modal.width('10px');
	modal.css('opacity','0.5');
	modal.modal('show');
	$('#send_button').show();
	
	modal.animate({ 
		width:width,opacity:0.5
    }, 800 );
	modal.animate({ 
		height:height,opacity:1
    }, 1000 );
}

function hide_contact_form(){
	var modal = $('#myModal');
	var height = modal.height();
	var width  = modal.width();
	
	modal.modal('show');
	modal.animate({ 
		height:10,opacity:0.5
    }, 1000 );
	modal.animate({ 
		width:10, opacity:0
    }, 800, function(){modal.modal('hide');});	 
}

function send_email(){
	if(!check_email($('#email_address').val())) return;
	
	$('#send_button').hide();
	$('#contact_form').hide();
	$('#send_email_success').show();
		
	var modal = $('#myModal');
	modal.animate({ 
		height:230,
		top:'77%'
    }, 700);
}

function check_email(email_address){
	var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
    var valid_email = pattern.test(email_address);
	
	if(!valid_email) {
		$('#invalid_email').show();
		$('#email_address').focus();
	}
	return valid_email;
}

function centralize(element){
	var height = 1;
}



function centralize(element){

	var height = 1;

}

